package com.macro.mall.portal.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.BmsTodayMorningExpress;
import com.macro.mall.portal.service.BmsTodayMorningExpressService;
import com.macro.mall.query.BmsTodayMorningExpressQuery;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;

/**
 * 今日早报
 * @author ASUS
 *
 */
@Controller
@Api(tags = "BmsTodayMorningExpress")
@Tag(name = "BmsTodayMorningExpress", description = "今日早报")
@RequestMapping("/todayMorningExpressMp")
public class BmsTodayMorningExpressController {
    
    @Autowired
    private BmsTodayMorningExpressService bmsTodayMorningExpressService;
    
    /**
     * 根据id获取今日早报信息
     * @param id
     * @return
     */
    @ApiOperation("根据id获取今日早报信息")
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    @ResponseBody
    public CommonResult<BmsTodayMorningExpress> getOneTodayMorningExpress (@PathVariable Long id){
        BmsTodayMorningExpress bmsTodayMorningExpress = bmsTodayMorningExpressService.getOneTodayMorningExpress(id);
        return CommonResult.success(bmsTodayMorningExpress);
    }
    
    /**
     * 分页查询今日早报信息
     * @param
     * @return
     */
    @ApiOperation("分页查询今日早报信息")
    @RequestMapping(value = "/mpList", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult<CommonPage<BmsTodayMorningExpress>> getALLTodayMorningExpress (@RequestBody BmsTodayMorningExpressQuery query){
        List<BmsTodayMorningExpress> bmsTodayMorningExpressList = bmsTodayMorningExpressService.getAllTodayMorningExpress(query);
        return CommonResult.success(CommonPage.restPage(bmsTodayMorningExpressList));
    }
}
